<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Deprecated thread API: GLib Reference Manual</title>
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="index.html" title="GLib Reference Manual">
<link rel="up" href="deprecated.html" title="Deprecated APIs">
<link rel="prev" href="deprecated.html" title="Deprecated APIs">
<link rel="next" href="glib-Caches.html" title="Caches">
<meta name="generator" content="GTK-Doc V1.25.1 (XML mode)">
<link rel="stylesheet" href="style.css" type="text/css">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table class="navigation" id="top" width="100%" summary="Navigation header" cellpadding="2" cellspacing="5"><tr valign="middle">
<td width="100%" align="left" class="shortcuts">
<a href="#" class="shortcut">Top</a><span id="nav_description">  <span class="dim">|</span> 
                  <a href="#glib-Deprecated-Thread-APIs.description" class="shortcut">Description</a></span>
</td>
<td><a accesskey="h" href="index.html"><img src="home.png" width="16" height="16" border="0" alt="Home"></a></td>
<td><a accesskey="u" href="deprecated.html"><img src="up.png" width="16" height="16" border="0" alt="Up"></a></td>
<td><a accesskey="p" href="deprecated.html"><img src="left.png" width="16" height="16" border="0" alt="Prev"></a></td>
<td><a accesskey="n" href="glib-Caches.html"><img src="right.png" width="16" height="16" border="0" alt="Next"></a></td>
</tr></table>
<div class="refentry">
<a name="glib-Deprecated-Thread-APIs"></a><div class="titlepage"></div>
<div class="refnamediv"><table width="100%"><tr>
<td valign="top">
<h2><span class="refentrytitle"><a name="glib-Deprecated-Thread-APIs.top_of_page"></a>Deprecated thread API</span></h2>
<p>Deprecated thread API — old thread APIs (for reference only)</p>
</td>
<td class="gallery_image" valign="top" align="right"></td>
</tr></table></div>
<div class="refsect1">
<a name="glib-Deprecated-Thread-APIs.functions"></a><h2>Functions</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="functions_return">
<col class="functions_name">
</colgroup>
<tbody>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()">g_thread_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-supported" title="g_thread_supported ()">g_thread_supported</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-get-initialized" title="g_thread_get_initialized ()">g_thread_get_initialized</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-create" title="g_thread_create ()">g_thread_create</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-create-full" title="g_thread_create_full ()">g_thread_create_full</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-set-priority" title="g_thread_set_priority ()">g_thread_set_priority</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-foreach" title="g_thread_foreach ()">g_thread_foreach</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="returnvalue">GMutex</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-new" title="g_mutex_new ()">g_mutex_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-free" title="g_mutex_free ()">g_mutex_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="returnvalue">GCond</span></a>*
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-new" title="g_cond_new ()">g_cond_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-free" title="g_cond_free ()">g_cond_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="returnvalue">GPrivate</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-private-new" title="g_private_new ()">g_private_new</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-init" title="g_static_mutex_init ()">g_static_mutex_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-lock" title="g_static_mutex_lock ()">g_static_mutex_lock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-trylock" title="g_static_mutex_trylock ()">g_static_mutex_trylock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-unlock" title="g_static_mutex_unlock ()">g_static_mutex_unlock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="returnvalue">GMutex</span></a> *
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-get-mutex" title="g_static_mutex_get_mutex ()">g_static_mutex_get_mutex</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-free" title="g_static_mutex_free ()">g_static_mutex_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-init" title="g_static_rec_mutex_init ()">g_static_rec_mutex_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()">g_static_rec_mutex_lock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-trylock" title="g_static_rec_mutex_trylock ()">g_static_rec_mutex_trylock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-unlock" title="g_static_rec_mutex_unlock ()">g_static_rec_mutex_unlock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock-full" title="g_static_rec_mutex_lock_full ()">g_static_rec_mutex_lock_full</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-unlock-full" title="g_static_rec_mutex_unlock_full ()">g_static_rec_mutex_unlock_full</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-free" title="g_static_rec_mutex_free ()">g_static_rec_mutex_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-init" title="g_static_rw_lock_init ()">g_static_rw_lock_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-lock" title="g_static_rw_lock_reader_lock ()">g_static_rw_lock_reader_lock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-trylock" title="g_static_rw_lock_reader_trylock ()">g_static_rw_lock_reader_trylock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()">g_static_rw_lock_reader_unlock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-lock" title="g_static_rw_lock_writer_lock ()">g_static_rw_lock_writer_lock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-trylock" title="g_static_rw_lock_writer_trylock ()">g_static_rw_lock_writer_trylock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-unlock" title="g_static_rw_lock_writer_unlock ()">g_static_rw_lock_writer_unlock</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-free" title="g_static_rw_lock_free ()">g_static_rw_lock_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-private-init" title="g_static_private_init ()">g_static_private_init</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-private-get" title="g_static_private_get ()">g_static_private_get</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-private-set" title="g_static_private_set ()">g_static_private_set</a> <span class="c_punctuation">()</span>
</td>
</tr>
<tr>
<td class="function_type">
<span class="returnvalue">void</span>
</td>
<td class="function_name">
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-private-free" title="g_static_private_free ()">g_static_private_free</a> <span class="c_punctuation">()</span>
</td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-Deprecated-Thread-APIs.other"></a><h2>Types and Values</h2>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="name">
<col class="description">
</colgroup>
<tbody>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-THREADS-IMPL-POSIX:CAPS" title="G_THREADS_IMPL_POSIX">G_THREADS_IMPL_POSIX</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-THREADS-IMPL-WIN32:CAPS" title="G_THREADS_IMPL_WIN32">G_THREADS_IMPL_WIN32</a></td>
</tr>
<tr>
<td class="datatype_keyword">enum</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GThreadPriority" title="enum GThreadPriority">GThreadPriority</a></td>
</tr>
<tr>
<td class="datatype_keyword"> </td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex">GStaticMutex</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-MUTEX-INIT:CAPS" title="G_STATIC_MUTEX_INIT">G_STATIC_MUTEX_INIT</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex">GStaticRecMutex</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-REC-MUTEX-INIT:CAPS" title="G_STATIC_REC_MUTEX_INIT">G_STATIC_REC_MUTEX_INIT</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock">GStaticRWLock</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-RW-LOCK-INIT:CAPS" title="G_STATIC_RW_LOCK_INIT">G_STATIC_RW_LOCK_INIT</a></td>
</tr>
<tr>
<td class="datatype_keyword">struct</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate">GStaticPrivate</a></td>
</tr>
<tr>
<td class="define_keyword">#define</td>
<td class="function_name"><a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-PRIVATE-INIT:CAPS" title="G_STATIC_PRIVATE_INIT">G_STATIC_PRIVATE_INIT</a></td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect1">
<a name="glib-Deprecated-Thread-APIs.includes"></a><h2>Includes</h2>
<pre class="synopsis">#include &lt;glib.h&gt;
</pre>
</div>
<div class="refsect1">
<a name="glib-Deprecated-Thread-APIs.description"></a><h2>Description</h2>
<p>These APIs are deprecated.  You should not use them in new code.
This section remains only to assist with understanding code that was
written to use these APIs at some point in the past.</p>
</div>
<div class="refsect1">
<a name="glib-Deprecated-Thread-APIs.functions_details"></a><h2>Functions</h2>
<div class="refsect2">
<a name="g-thread-init"></a><h3>g_thread_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_thread_init (<em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> vtable</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_thread_init</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>This function is no longer necessary. The GLib
    threading system is automatically initialized at the start
    of your program.</p>
</div>
<p>If you use GLib from more than one thread, you must initialize the
thread system by calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>.</p>
<p>Since version 2.24, calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> multiple times is allowed,
but nothing happens except for the first call.</p>
<p>Since version 2.32, GLib does not support custom thread implementations
anymore and the <em class="parameter"><code>vtable</code></em>
 parameter is ignored and you should pass <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
<p>&lt;note&gt;&lt;para&gt;<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> must not be called directly or indirectly
in a callback from GLib. Also no mutexes may be currently locked while
calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>.&lt;/para&gt;&lt;/note&gt;</p>
<p>&lt;note&gt;&lt;para&gt;To use <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> in your program, you have to link
with the libraries that the command &lt;command&gt;pkg-config --libs
gthread-2.0&lt;/command&gt; outputs. This is not the case for all the
other thread-related functions of GLib. Those can be used without
having to link with the thread libraries.&lt;/para&gt;&lt;/note&gt;</p>
<div class="refsect3">
<a name="g-thread-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>vtable</p></td>
<td class="parameter_description"><p>a function table of type <span class="type">GThreadFunctions</span>, that provides
the entry points to the thread system to be used. Since 2.32,
this parameter is ignored and should always be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-thread-supported"></a><h3>g_thread_supported ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_thread_supported ();</pre>
<div class="warning"><p><code class="literal">g_thread_supported</code> is deprecated and should not be used in newly-written code.</p></div>
<p>This macro returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if the thread system is initialized,
and <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a> if it is not.</p>
<p>For language bindings, <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-get-initialized" title="g_thread_get_initialized ()"><code class="function">g_thread_get_initialized()</code></a> provides
the same functionality as a function.</p>
<div class="refsect3">
<a name="g-thread-supported.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if the thread system is initialized</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-thread-get-initialized"></a><h3>g_thread_get_initialized ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_thread_get_initialized (<em class="parameter"><code><span class="type">void</span></code></em>);</pre>
<div class="warning"><p><code class="literal">g_thread_get_initialized</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Indicates if <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has been called.</p>
<div class="refsect3">
<a name="g-thread-get-initialized.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a> if threads have been initialized.</p>
</div>
<p class="since">Since: <a class="link" href="api-index-2-20.html#api-index-2.20">2.20</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-thread-create"></a><h3>g_thread_create ()</h3>
<pre class="programlisting"><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> *
g_thread_create (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()"><span class="type">GThreadFunc</span></a> func</code></em>,
                 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
                 <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> joinable</code></em>,
                 <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_thread_create</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-thread-new" title="g_thread_new ()"><code class="function">g_thread_new()</code></a> instead</p>
</div>
<p>This function creates a new thread.</p>
<p>The new thread executes the function <em class="parameter"><code>func</code></em>
 with the argument <em class="parameter"><code>data</code></em>
.
If the thread was created successfully, it is returned.</p>
<p><em class="parameter"><code>error</code></em>
 can be <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to ignore errors, or non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> to report errors.
The error is set, if and only if the function returns <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>.</p>
<p>This function returns a reference to the created thread only if
<em class="parameter"><code>joinable</code></em>
 is <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.  In that case, you must free this reference by
calling <a class="link" href="glib-Threads.html#g-thread-unref" title="g_thread_unref ()"><code class="function">g_thread_unref()</code></a> or <a class="link" href="glib-Threads.html#g-thread-join" title="g_thread_join ()"><code class="function">g_thread_join()</code></a>.  If <em class="parameter"><code>joinable</code></em>
 is <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>
then you should probably not touch the return value.</p>
<div class="refsect3">
<a name="g-thread-create.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>func</p></td>
<td class="parameter_description"><p>a function to execute in the new thread</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>an argument to supply to the new thread</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>joinable</p></td>
<td class="parameter_description"><p>should this thread be joinable?</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for error, or <a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-thread-create.returns"></a><h4>Returns</h4>
<p> the new <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> on success</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-thread-create-full"></a><h3>g_thread_create_full ()</h3>
<pre class="programlisting"><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="returnvalue">GThread</span></a> *
g_thread_create_full (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThreadFunc" title="GThreadFunc ()"><span class="type">GThreadFunc</span></a> func</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gulong" title="gulong"><span class="type">gulong</span></a> stack_size</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> joinable</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="type">gboolean</span></a> bound</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GThreadPriority" title="enum GThreadPriority"><span class="type">GThreadPriority</span></a> priority</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Error-Reporting.html#GError" title="struct GError"><span class="type">GError</span></a> **error</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_thread_create_full</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>The <em class="parameter"><code>bound</code></em>
 and <em class="parameter"><code>priority</code></em>
 arguments are now ignored.
Use <a class="link" href="glib-Threads.html#g-thread-new" title="g_thread_new ()"><code class="function">g_thread_new()</code></a>.</p>
</div>
<p>This function creates a new thread.</p>
<div class="refsect3">
<a name="g-thread-create-full.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>func</p></td>
<td class="parameter_description"><p>a function to execute in the new thread.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>an argument to supply to the new thread.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>stack_size</p></td>
<td class="parameter_description"><p>a stack size for the new thread.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>joinable</p></td>
<td class="parameter_description"><p>should this thread be joinable?</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>bound</p></td>
<td class="parameter_description"><p>ignored</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>priority</p></td>
<td class="parameter_description"><p>ignored</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>error</p></td>
<td class="parameter_description"><p>return location for error.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-thread-create-full.returns"></a><h4>Returns</h4>
<p> the new <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> on success.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-thread-set-priority"></a><h3>g_thread_set_priority ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_thread_set_priority (<em class="parameter"><code><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> *thread</code></em>,
                       <em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GThreadPriority" title="enum GThreadPriority"><span class="type">GThreadPriority</span></a> priority</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_thread_set_priority</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Thread priorities no longer have any effect.</p>
</div>
<p>This function does nothing.</p>
<div class="refsect3">
<a name="g-thread-set-priority.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>thread</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>priority</p></td>
<td class="parameter_description"><p>ignored</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-thread-foreach"></a><h3>g_thread_foreach ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_thread_foreach (<em class="parameter"><code><a class="link" href="glib-Doubly-Linked-Lists.html#GFunc" title="GFunc ()"><span class="type">GFunc</span></a> thread_func</code></em>,
                  <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> user_data</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_thread_foreach</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>There aren't many things you can do with a <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a>,
    except comparing it with one that was returned from <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a>.
    There are better ways to find out if your thread is still alive.</p>
</div>
<p>Call <em class="parameter"><code>thread_func</code></em>
 on all <a href="glib-Threads.html#GThread"><span class="type">GThreads</span></a> that have been
created with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-create" title="g_thread_create ()"><code class="function">g_thread_create()</code></a>.</p>
<p>Note that threads may decide to exit while <em class="parameter"><code>thread_func</code></em>
 is
running, so without intimate knowledge about the lifetime of
foreign threads, <em class="parameter"><code>thread_func</code></em>
 shouldn't access the GThread*
pointer passed in as first argument. However, <em class="parameter"><code>thread_func</code></em>
 will
not be called for threads which are known to have exited already.</p>
<p>Due to thread lifetime checks, this function has an execution complexity
which is quadratic in the number of existing threads.</p>
<div class="refsect3">
<a name="g-thread-foreach.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>thread_func</p></td>
<td class="parameter_description"><p>function to call for all <a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a> structures</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>user_data</p></td>
<td class="parameter_description"><p>second argument to <em class="parameter"><code>thread_func</code></em>
</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
<p class="since">Since: <a class="link" href="api-index-2-10.html#api-index-2.10">2.10</a></p>
</div>
<hr>
<div class="refsect2">
<a name="g-mutex-new"></a><h3>g_mutex_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="returnvalue">GMutex</span></a> *
g_mutex_new ();</pre>
<div class="warning">
<p><code class="literal">g_mutex_new</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>GMutex can now be statically allocated, or embedded
in structures and initialised with <a class="link" href="glib-Threads.html#g-mutex-init" title="g_mutex_init ()"><code class="function">g_mutex_init()</code></a>.</p>
</div>
<p>Allocates and initializes a new <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>.</p>
<div class="refsect3">
<a name="g-mutex-new.returns"></a><h4>Returns</h4>
<p> a newly allocated <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>. Use <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-free" title="g_mutex_free ()"><code class="function">g_mutex_free()</code></a> to free</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-mutex-free"></a><h3>g_mutex_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_mutex_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_mutex_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>GMutex can now be statically allocated, or embedded
in structures and initialised with <a class="link" href="glib-Threads.html#g-mutex-init" title="g_mutex_init ()"><code class="function">g_mutex_init()</code></a>.</p>
</div>
<p>Destroys a <em class="parameter"><code>mutex</code></em>
 that has been created with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-new" title="g_mutex_new ()"><code class="function">g_mutex_new()</code></a>.</p>
<p>Calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-free" title="g_mutex_free ()"><code class="function">g_mutex_free()</code></a> on a locked mutex may result
in undefined behaviour.</p>
<div class="refsect3">
<a name="g-mutex-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-cond-new"></a><h3>g_cond_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="returnvalue">GCond</span></a>*
g_cond_new ();</pre>
<div class="warning">
<p><code class="literal">g_cond_new</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>GCond can now be statically allocated, or embedded
in structures and initialised with <a class="link" href="glib-Threads.html#g-cond-init" title="g_cond_init ()"><code class="function">g_cond_init()</code></a>.</p>
</div>
<p>Allocates and initializes a new <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a>.</p>
<div class="refsect3">
<a name="g-cond-new.returns"></a><h4>Returns</h4>
<p> a newly allocated <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a>. Free with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-free" title="g_cond_free ()"><code class="function">g_cond_free()</code></a></p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-cond-free"></a><h3>g_cond_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_cond_free (<em class="parameter"><code><a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a> *cond</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_cond_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>GCond can now be statically allocated, or embedded
in structures and initialised with <a class="link" href="glib-Threads.html#g-cond-init" title="g_cond_init ()"><code class="function">g_cond_init()</code></a>.</p>
</div>
<p>Destroys a <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a> that has been created with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-new" title="g_cond_new ()"><code class="function">g_cond_new()</code></a>.</p>
<p>Calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-cond-free" title="g_cond_free ()"><code class="function">g_cond_free()</code></a> for a <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a> on which threads are
blocking leads to undefined behaviour.</p>
<div class="refsect3">
<a name="g-cond-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>cond</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Threads.html#GCond" title="struct GCond"><span class="type">GCond</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-private-new"></a><h3>g_private_new ()</h3>
<pre class="programlisting"><a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="returnvalue">GPrivate</span></a> *
g_private_new (<em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_private_new</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>dynamic allocation of <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a> is a bad idea.  Use
                 static storage and <a class="link" href="glib-Threads.html#G-PRIVATE-INIT:CAPS" title="G_PRIVATE_INIT()"><code class="function">G_PRIVATE_INIT()</code></a> instead.</p>
</div>
<p>Creates a new <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a>.</p>
<div class="refsect3">
<a name="g-private-new.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>notify</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-private-new.returns"></a><h4>Returns</h4>
<p> a newly allocated <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a> (which can never be destroyed)</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-mutex-init"></a><h3>g_static_mutex_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_mutex_init (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_mutex_init</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-mutex-init" title="g_mutex_init ()"><code class="function">g_mutex_init()</code></a></p>
</div>
<p>Initializes <em class="parameter"><code>mutex</code></em>
.
Alternatively you can initialize it with <a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-MUTEX-INIT:CAPS" title="G_STATIC_MUTEX_INIT"><span class="type">G_STATIC_MUTEX_INIT</span></a>.</p>
<div class="refsect3">
<a name="g-static-mutex-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> to be initialized.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-mutex-lock"></a><h3>g_static_mutex_lock ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_mutex_lock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_mutex_lock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()"><code class="function">g_mutex_lock()</code></a></p>
</div>
<p>Works like <a class="link" href="glib-Threads.html#g-mutex-lock" title="g_mutex_lock ()"><code class="function">g_mutex_lock()</code></a>, but for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
<div class="refsect3">
<a name="g-static-mutex-lock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-mutex-trylock"></a><h3>g_static_mutex_trylock ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_static_mutex_trylock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_mutex_trylock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-mutex-trylock" title="g_mutex_trylock ()"><code class="function">g_mutex_trylock()</code></a></p>
</div>
<p>Works like <a class="link" href="glib-Threads.html#g-mutex-trylock" title="g_mutex_trylock ()"><code class="function">g_mutex_trylock()</code></a>, but for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
<div class="refsect3">
<a name="g-static-mutex-trylock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-static-mutex-trylock.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> could be locked.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-mutex-unlock"></a><h3>g_static_mutex_unlock ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_mutex_unlock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_mutex_unlock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-mutex-unlock" title="g_mutex_unlock ()"><code class="function">g_mutex_unlock()</code></a></p>
</div>
<p>Works like <a class="link" href="glib-Threads.html#g-mutex-unlock" title="g_mutex_unlock ()"><code class="function">g_mutex_unlock()</code></a>, but for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
<div class="refsect3">
<a name="g-static-mutex-unlock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-mutex-get-mutex"></a><h3>g_static_mutex_get_mutex ()</h3>
<pre class="programlisting"><a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="returnvalue">GMutex</span></a> *
g_static_mutex_get_mutex (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_mutex_get_mutex</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Just use a <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a></p>
</div>
<p>For some operations (like <a class="link" href="glib-Threads.html#g-cond-wait" title="g_cond_wait ()"><code class="function">g_cond_wait()</code></a>) you must have a <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>
instead of a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>. This function will return the
corresponding <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> for <em class="parameter"><code>mutex</code></em>
.</p>
<div class="refsect3">
<a name="g-static-mutex-get-mutex.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-static-mutex-get-mutex.returns"></a><h4>Returns</h4>
<p> the <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> corresponding to <em class="parameter"><code>mutex</code></em>
.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-mutex-free"></a><h3>g_static_mutex_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_mutex_free (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_mutex_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-mutex-clear" title="g_mutex_clear ()"><code class="function">g_mutex_clear()</code></a></p>
</div>
<p>Releases all resources allocated to <em class="parameter"><code>mutex</code></em>
.</p>
<p>You don't have to call this functions for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> with an
unbounded lifetime, i.e. objects declared 'static', but if you have
a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> as a member of a structure and the structure is
freed, you should also free the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
<p>Calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-free" title="g_static_mutex_free ()"><code class="function">g_static_mutex_free()</code></a> on a locked mutex may result in
undefined behaviour.</p>
<div class="refsect3">
<a name="g-static-mutex-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> to be freed.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rec-mutex-init"></a><h3>g_static_rec_mutex_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rec_mutex_init (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rec_mutex_init</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-init" title="g_rec_mutex_init ()"><code class="function">g_rec_mutex_init()</code></a></p>
</div>
<p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> must be initialized with this function before it
can be used. Alternatively you can initialize it with
<a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-REC-MUTEX-INIT:CAPS" title="G_STATIC_REC_MUTEX_INIT"><span class="type">G_STATIC_REC_MUTEX_INIT</span></a>.</p>
<div class="refsect3">
<a name="g-static-rec-mutex-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to be initialized.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rec-mutex-lock"></a><h3>g_static_rec_mutex_lock ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rec_mutex_lock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rec_mutex_lock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-lock" title="g_rec_mutex_lock ()"><code class="function">g_rec_mutex_lock()</code></a></p>
</div>
<p>Locks <em class="parameter"><code>mutex</code></em>
. If <em class="parameter"><code>mutex</code></em>
 is already locked by another thread, the
current thread will block until <em class="parameter"><code>mutex</code></em>
 is unlocked by the other
thread. If <em class="parameter"><code>mutex</code></em>
 is already locked by the calling thread, this
functions increases the depth of <em class="parameter"><code>mutex</code></em>
 and returns immediately.</p>
<div class="refsect3">
<a name="g-static-rec-mutex-lock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to lock.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rec-mutex-trylock"></a><h3>g_static_rec_mutex_trylock ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_static_rec_mutex_trylock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rec_mutex_trylock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-trylock" title="g_rec_mutex_trylock ()"><code class="function">g_rec_mutex_trylock()</code></a></p>
</div>
<p>Tries to lock <em class="parameter"><code>mutex</code></em>
. If <em class="parameter"><code>mutex</code></em>
 is already locked by another thread,
it immediately returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise it locks <em class="parameter"><code>mutex</code></em>
 and returns
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. If <em class="parameter"><code>mutex</code></em>
 is already locked by the calling thread, this
functions increases the depth of <em class="parameter"><code>mutex</code></em>
 and immediately returns
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
<div class="refsect3">
<a name="g-static-rec-mutex-trylock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to lock.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-static-rec-mutex-trylock.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>mutex</code></em>
could be locked.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rec-mutex-unlock"></a><h3>g_static_rec_mutex_unlock ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rec_mutex_unlock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rec_mutex_unlock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-unlock" title="g_rec_mutex_unlock ()"><code class="function">g_rec_mutex_unlock()</code></a></p>
</div>
<p>Unlocks <em class="parameter"><code>mutex</code></em>
. Another thread will be allowed to lock <em class="parameter"><code>mutex</code></em>
 only
when it has been unlocked as many times as it had been locked
before. If <em class="parameter"><code>mutex</code></em>
 is completely unlocked and another thread is
blocked in a <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()"><code class="function">g_static_rec_mutex_lock()</code></a> call for <em class="parameter"><code>mutex</code></em>
, it will be
woken and can lock <em class="parameter"><code>mutex</code></em>
 itself.</p>
<div class="refsect3">
<a name="g-static-rec-mutex-unlock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to unlock.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rec-mutex-lock-full"></a><h3>g_static_rec_mutex_lock_full ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rec_mutex_lock_full (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>,
                              <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="type">guint</span></a> depth</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rec_mutex_lock_full</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-lock" title="g_rec_mutex_lock ()"><code class="function">g_rec_mutex_lock()</code></a></p>
</div>
<p>Works like calling <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()"><code class="function">g_static_rec_mutex_lock()</code></a> for <em class="parameter"><code>mutex</code></em>
 <em class="parameter"><code>depth</code></em>
 times.</p>
<div class="refsect3">
<a name="g-static-rec-mutex-lock-full.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to lock.</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>depth</p></td>
<td class="parameter_description"><p>number of times this mutex has to be unlocked to be
completely unlocked.</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rec-mutex-unlock-full"></a><h3>g_static_rec_mutex_unlock_full ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#guint" title="guint ()"><span class="returnvalue">guint</span></a>
g_static_rec_mutex_unlock_full (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rec_mutex_unlock_full</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-unlock" title="g_rec_mutex_unlock ()"><code class="function">g_rec_mutex_unlock()</code></a></p>
</div>
<p>Completely unlocks <em class="parameter"><code>mutex</code></em>
. If another thread is blocked in a
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock" title="g_static_rec_mutex_lock ()"><code class="function">g_static_rec_mutex_lock()</code></a> call for <em class="parameter"><code>mutex</code></em>
, it will be woken and can
lock <em class="parameter"><code>mutex</code></em>
 itself. This function returns the number of times that
<em class="parameter"><code>mutex</code></em>
 has been locked by the current thread. To restore the state
before the call to <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-unlock-full" title="g_static_rec_mutex_unlock_full ()"><code class="function">g_static_rec_mutex_unlock_full()</code></a> you can call
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock-full" title="g_static_rec_mutex_lock_full ()"><code class="function">g_static_rec_mutex_lock_full()</code></a> with the depth returned by this
function.</p>
<div class="refsect3">
<a name="g-static-rec-mutex-unlock-full.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to completely unlock.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-static-rec-mutex-unlock-full.returns"></a><h4>Returns</h4>
<p> number of times <em class="parameter"><code>mutex</code></em>
has been locked by the current
thread.</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rec-mutex-free"></a><h3>g_static_rec_mutex_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rec_mutex_free (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> *mutex</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rec_mutex_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-rec-mutex-clear" title="g_rec_mutex_clear ()"><code class="function">g_rec_mutex_clear()</code></a></p>
</div>
<p>Releases all resources allocated to a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a>.</p>
<p>You don't have to call this functions for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> with an
unbounded lifetime, i.e. objects declared 'static', but if you have
a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> as a member of a structure and the structure is
freed, you should also free the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a>.</p>
<div class="refsect3">
<a name="g-static-rec-mutex-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>mutex</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> to be freed.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rw-lock-init"></a><h3>g_static_rw_lock_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rw_lock_init (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rw_lock_init</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-rw-lock-init" title="g_rw_lock_init ()"><code class="function">g_rw_lock_init()</code></a> instead</p>
</div>
<p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> must be initialized with this function before it
can be used. Alternatively you can initialize it with
<a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-RW-LOCK-INIT:CAPS" title="G_STATIC_RW_LOCK_INIT"><span class="type">G_STATIC_RW_LOCK_INIT</span></a>.</p>
<div class="refsect3">
<a name="g-static-rw-lock-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>lock</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to be initialized.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rw-lock-reader-lock"></a><h3>g_static_rw_lock_reader_lock ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rw_lock_reader_lock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rw_lock_reader_lock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use <a class="link" href="glib-Threads.html#g-rw-lock-reader-lock" title="g_rw_lock_reader_lock ()"><code class="function">g_rw_lock_reader_lock()</code></a> instead</p>
</div>
<p>Locks <em class="parameter"><code>lock</code></em>
 for reading. There may be unlimited concurrent locks for
reading of a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> at the same time.  If <em class="parameter"><code>lock</code></em>
 is already
locked for writing by another thread or if another thread is already
waiting to lock <em class="parameter"><code>lock</code></em>
 for writing, this function will block until
<em class="parameter"><code>lock</code></em>
 is unlocked by the other writing thread and no other writing
threads want to lock <em class="parameter"><code>lock</code></em>
. This lock has to be unlocked by
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()"><code class="function">g_static_rw_lock_reader_unlock()</code></a>.</p>
<p><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> is not recursive. It might seem to be possible to
recursively lock for reading, but that can result in a deadlock, due
to writer preference.</p>
<div class="refsect3">
<a name="g-static-rw-lock-reader-lock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>lock</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for reading.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rw-lock-reader-trylock"></a><h3>g_static_rw_lock_reader_trylock ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_static_rw_lock_reader_trylock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
<div class="warning"><p><code class="literal">g_static_rw_lock_reader_trylock</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Tries to lock <em class="parameter"><code>lock</code></em>
 for reading. If <em class="parameter"><code>lock</code></em>
 is already locked for
writing by another thread or if another thread is already waiting to
lock <em class="parameter"><code>lock</code></em>
 for writing, immediately returns <a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise locks
<em class="parameter"><code>lock</code></em>
 for reading and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. This lock has to be unlocked by
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()"><code class="function">g_static_rw_lock_reader_unlock()</code></a>.</p>
<div class="refsect3">
<a name="g-static-rw-lock-reader-trylock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>lock</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for reading</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-static-rw-lock-reader-trylock.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>lock</code></em>
could be locked for reading</p>
<p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-reader-trylock" title="g_rw_lock_reader_trylock ()"><code class="function">g_rw_lock_reader_trylock()</code></a> instead</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rw-lock-reader-unlock"></a><h3>g_static_rw_lock_reader_unlock ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rw_lock_reader_unlock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
<div class="warning"><p><code class="literal">g_static_rw_lock_reader_unlock</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Unlocks <em class="parameter"><code>lock</code></em>
. If a thread waits to lock <em class="parameter"><code>lock</code></em>
 for writing and all
locks for reading have been unlocked, the waiting thread is woken up
and can lock <em class="parameter"><code>lock</code></em>
 for writing.</p>
<p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-reader-unlock" title="g_rw_lock_reader_unlock ()"><code class="function">g_rw_lock_reader_unlock()</code></a> instead</p>
<div class="refsect3">
<a name="g-static-rw-lock-reader-unlock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>lock</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to unlock after reading</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rw-lock-writer-lock"></a><h3>g_static_rw_lock_writer_lock ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rw_lock_writer_lock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
<div class="warning"><p><code class="literal">g_static_rw_lock_writer_lock</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Locks <em class="parameter"><code>lock</code></em>
 for writing. If <em class="parameter"><code>lock</code></em>
 is already locked for writing or
reading by other threads, this function will block until <em class="parameter"><code>lock</code></em>
 is
completely unlocked and then lock <em class="parameter"><code>lock</code></em>
 for writing. While this
functions waits to lock <em class="parameter"><code>lock</code></em>
, no other thread can lock <em class="parameter"><code>lock</code></em>
 for
reading. When <em class="parameter"><code>lock</code></em>
 is locked for writing, no other thread can lock
<em class="parameter"><code>lock</code></em>
 (neither for reading nor writing). This lock has to be
unlocked by <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-unlock" title="g_static_rw_lock_writer_unlock ()"><code class="function">g_static_rw_lock_writer_unlock()</code></a>.</p>
<p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-writer-lock" title="g_rw_lock_writer_lock ()"><code class="function">g_rw_lock_writer_lock()</code></a> instead</p>
<div class="refsect3">
<a name="g-static-rw-lock-writer-lock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>lock</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for writing</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rw-lock-writer-trylock"></a><h3>g_static_rw_lock_writer_trylock ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gboolean" title="gboolean"><span class="returnvalue">gboolean</span></a>
g_static_rw_lock_writer_trylock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
<div class="warning"><p><code class="literal">g_static_rw_lock_writer_trylock</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Tries to lock <em class="parameter"><code>lock</code></em>
 for writing. If <em class="parameter"><code>lock</code></em>
 is already locked (for
either reading or writing) by another thread, it immediately returns
<a class="link" href="glib-Standard-Macros.html#FALSE:CAPS" title="FALSE"><code class="literal">FALSE</code></a>. Otherwise it locks <em class="parameter"><code>lock</code></em>
 for writing and returns <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>. This
lock has to be unlocked by <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-unlock" title="g_static_rw_lock_writer_unlock ()"><code class="function">g_static_rw_lock_writer_unlock()</code></a>.</p>
<div class="refsect3">
<a name="g-static-rw-lock-writer-trylock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>lock</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to lock for writing</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-static-rw-lock-writer-trylock.returns"></a><h4>Returns</h4>
<p> <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>, if <em class="parameter"><code>lock</code></em>
could be locked for writing</p>
<p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-writer-trylock" title="g_rw_lock_writer_trylock ()"><code class="function">g_rw_lock_writer_trylock()</code></a> instead</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rw-lock-writer-unlock"></a><h3>g_static_rw_lock_writer_unlock ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rw_lock_writer_unlock (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
<div class="warning"><p><code class="literal">g_static_rw_lock_writer_unlock</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Unlocks <em class="parameter"><code>lock</code></em>
. If a thread is waiting to lock <em class="parameter"><code>lock</code></em>
 for writing and
all locks for reading have been unlocked, the waiting thread is
woken up and can lock <em class="parameter"><code>lock</code></em>
 for writing. If no thread is waiting to
lock <em class="parameter"><code>lock</code></em>
 for writing, and some thread or threads are waiting to
lock <em class="parameter"><code>lock</code></em>
 for reading, the waiting threads are woken up and can
lock <em class="parameter"><code>lock</code></em>
 for reading.</p>
<p>Deprectated: 2.32: Use <a class="link" href="glib-Threads.html#g-rw-lock-writer-unlock" title="g_rw_lock_writer_unlock ()"><code class="function">g_rw_lock_writer_unlock()</code></a> instead</p>
<div class="refsect3">
<a name="g-static-rw-lock-writer-unlock.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>lock</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to unlock after writing.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-rw-lock-free"></a><h3>g_static_rw_lock_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_rw_lock_free (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> *lock</code></em>);</pre>
<div class="warning">
<p><code class="literal">g_static_rw_lock_free</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use a <a class="link" href="glib-Threads.html#GRWLock" title="struct GRWLock"><span class="type">GRWLock</span></a> instead</p>
</div>
<p>Releases all resources allocated to <em class="parameter"><code>lock</code></em>
.</p>
<p>You don't have to call this functions for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> with an
unbounded lifetime, i.e. objects declared 'static', but if you have
a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> as a member of a structure, and the structure is
freed, you should also free the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a>.</p>
<div class="refsect3">
<a name="g-static-rw-lock-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>lock</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> to be freed.</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-private-init"></a><h3>g_static_private_init ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_private_init (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);</pre>
<div class="warning"><p><code class="literal">g_static_private_init</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Initializes <em class="parameter"><code>private_key</code></em>
. Alternatively you can initialize it with
<a class="link" href="glib-Deprecated-Thread-APIs.html#G-STATIC-PRIVATE-INIT:CAPS" title="G_STATIC_PRIVATE_INIT"><span class="type">G_STATIC_PRIVATE_INIT</span></a>.</p>
<div class="refsect3">
<a name="g-static-private-init.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>private_key</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> to be initialized</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-private-get"></a><h3>g_static_private_get ()</h3>
<pre class="programlisting"><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="returnvalue">gpointer</span></a>
g_static_private_get (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);</pre>
<div class="warning"><p><code class="literal">g_static_private_get</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Works like <a class="link" href="glib-Threads.html#g-private-get" title="g_private_get ()"><code class="function">g_private_get()</code></a> only for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a>.</p>
<p>This function works even if <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been called.</p>
<div class="refsect3">
<a name="g-static-private-get.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>private_key</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
<div class="refsect3">
<a name="g-static-private-get.returns"></a><h4>Returns</h4>
<p> the corresponding pointer</p>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-private-set"></a><h3>g_static_private_set ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_private_set (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Basic-Types.html#gpointer" title="gpointer"><span class="type">gpointer</span></a> data</code></em>,
                      <em class="parameter"><code><a class="link" href="glib-Datasets.html#GDestroyNotify" title="GDestroyNotify ()"><span class="type">GDestroyNotify</span></a> notify</code></em>);</pre>
<div class="warning"><p><code class="literal">g_static_private_set</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Sets the pointer keyed to <em class="parameter"><code>private_key</code></em>
 for the current thread and
the function <em class="parameter"><code>notify</code></em>
 to be called with that pointer (<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a> or
non-<a class="link" href="glib-Standard-Macros.html#NULL:CAPS" title="NULL"><code class="literal">NULL</code></a>), whenever the pointer is set again or whenever the
current thread ends.</p>
<p>This function works even if <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not yet been called.
If <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> is called later, the <em class="parameter"><code>data</code></em>
 keyed to <em class="parameter"><code>private_key</code></em>

will be inherited only by the main thread, i.e. the one that called
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>.</p>
<p><em class="parameter"><code>notify</code></em>
 is used quite differently from <em class="parameter"><code>destructor</code></em>
 in <a class="link" href="glib-Deprecated-Thread-APIs.html#g-private-new" title="g_private_new ()"><code class="function">g_private_new()</code></a>.</p>
<div class="refsect3">
<a name="g-static-private-set.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody>
<tr>
<td class="parameter_name"><p>private_key</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a></p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>data</p></td>
<td class="parameter_description"><p>the new pointer</p></td>
<td class="parameter_annotations"> </td>
</tr>
<tr>
<td class="parameter_name"><p>notify</p></td>
<td class="parameter_description"><p>a function to be called with the pointer whenever the
current thread ends or sets this pointer again</p></td>
<td class="parameter_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="g-static-private-free"></a><h3>g_static_private_free ()</h3>
<pre class="programlisting"><span class="returnvalue">void</span>
g_static_private_free (<em class="parameter"><code><a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> *private_key</code></em>);</pre>
<div class="warning"><p><code class="literal">g_static_private_free</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Releases all resources allocated to <em class="parameter"><code>private_key</code></em>
.</p>
<p>You don't have to call this functions for a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> with an
unbounded lifetime, i.e. objects declared 'static', but if you have
a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> as a member of a structure and the structure is
freed, you should also free the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a>.</p>
<div class="refsect3">
<a name="g-static-private-free.parameters"></a><h4>Parameters</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="150px" class="parameters_name">
<col class="parameters_description">
<col width="200px" class="parameters_annotations">
</colgroup>
<tbody><tr>
<td class="parameter_name"><p>private_key</p></td>
<td class="parameter_description"><p>a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> to be freed</p></td>
<td class="parameter_annotations"> </td>
</tr></tbody>
</table></div>
</div>
</div>
</div>
<div class="refsect1">
<a name="glib-Deprecated-Thread-APIs.other_details"></a><h2>Types and Values</h2>
<div class="refsect2">
<a name="G-THREADS-IMPL-POSIX:CAPS"></a><h3>G_THREADS_IMPL_POSIX</h3>
<pre class="programlisting">#define G_THREADS_IMPL_POSIX
</pre>
<div class="warning">
<p><code class="literal">G_THREADS_IMPL_POSIX</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>POSIX threads are in use on all non-Windows systems.
                Use G_OS_WIN32 to detect Windows.</p>
</div>
<p>This macro is defined if POSIX style threads are used.</p>
</div>
<hr>
<div class="refsect2">
<a name="G-THREADS-IMPL-WIN32:CAPS"></a><h3>G_THREADS_IMPL_WIN32</h3>
<pre class="programlisting">#define G_THREADS_IMPL_NONE
</pre>
<div class="warning">
<p><code class="literal">G_THREADS_IMPL_WIN32</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use G_OS_WIN32 to detect Windows.</p>
</div>
<p>This macro is defined if Windows style threads are used.</p>
</div>
<hr>
<div class="refsect2">
<a name="GThreadPriority"></a><h3>enum GThreadPriority</h3>
<div class="warning">
<p><code class="literal">GThreadPriority</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Thread priorities no longer have any effect.</p>
</div>
<p>Thread priorities.</p>
<div class="refsect3">
<a name="GThreadPriority.members"></a><h4>Members</h4>
<div class="informaltable"><table class="informaltable" width="100%" border="0">
<colgroup>
<col width="300px" class="enum_members_name">
<col class="enum_members_description">
<col width="200px" class="enum_members_annotations">
</colgroup>
<tbody>
<tr>
<td class="enum_member_name"><p><a name="G-THREAD-PRIORITY-LOW:CAPS"></a>G_THREAD_PRIORITY_LOW</p></td>
<td class="enum_member_description">
<p>a priority lower than normal</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-THREAD-PRIORITY-NORMAL:CAPS"></a>G_THREAD_PRIORITY_NORMAL</p></td>
<td class="enum_member_description">
<p>the default priority</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-THREAD-PRIORITY-HIGH:CAPS"></a>G_THREAD_PRIORITY_HIGH</p></td>
<td class="enum_member_description">
<p>a priority higher than normal</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
<tr>
<td class="enum_member_name"><p><a name="G-THREAD-PRIORITY-URGENT:CAPS"></a>G_THREAD_PRIORITY_URGENT</p></td>
<td class="enum_member_description">
<p>the highest priority</p>
</td>
<td class="enum_member_annotations"> </td>
</tr>
</tbody>
</table></div>
</div>
</div>
<hr>
<div class="refsect2">
<a name="GStaticMutex"></a><h3>GStaticMutex</h3>
<pre class="programlisting">typedef struct _GStaticMutex GStaticMutex;</pre>
<p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> works like a <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>.</p>
<p>Prior to GLib 2.32, GStaticMutex had the significant advantage
that it doesn't need to be created at run-time, but can be defined
at compile-time. Since 2.32, <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> can be statically allocated
as well, and GStaticMutex has been deprecated.</p>
<p>Here is a version of our <code class="function">give_me_next_number()</code> example using
a GStaticMutex:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">int</span>
<span class="function">give_me_next_number</span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">void</span><span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  <span class="gtkdoc kwb">static int</span> current_number <span class="gtkdoc opt">=</span> <span class="number">0</span><span class="gtkdoc opt">;</span>
  <span class="gtkdoc kwb">int</span> ret_val<span class="gtkdoc opt">;</span>
  <span class="gtkdoc kwb">static</span> GStaticMutex mutex <span class="gtkdoc opt">=</span> G_STATIC_MUTEX_INIT<span class="gtkdoc opt">;</span>

  <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-mutex-lock">g_static_mutex_lock</a></span> <span class="gtkdoc opt">(&amp;</span>mutex<span class="gtkdoc opt">);</span>
  ret_val <span class="gtkdoc opt">=</span> current_number <span class="gtkdoc opt">=</span> <span class="function">calc_next_number</span> <span class="gtkdoc opt">(</span>current_number<span class="gtkdoc opt">);</span>
  <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-mutex-unlock">g_static_mutex_unlock</a></span> <span class="gtkdoc opt">(&amp;</span>mutex<span class="gtkdoc opt">);</span>

  <span class="keyword">return</span> ret_val<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>Sometimes you would like to dynamically create a mutex. If you don't
want to require prior calling to <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>, because your code
should also be usable in non-threaded programs, you are not able to
use <a class="link" href="glib-Deprecated-Thread-APIs.html#g-mutex-new" title="g_mutex_new ()"><code class="function">g_mutex_new()</code></a> and thus <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a>, as that requires a prior call to
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>. In theses cases you can also use a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.
It must be initialized with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-init" title="g_static_mutex_init ()"><code class="function">g_static_mutex_init()</code></a> before using it
and freed with with <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-free" title="g_static_mutex_free ()"><code class="function">g_static_mutex_free()</code></a> when not needed anymore to
free up any allocated resources.</p>
<p>Even though <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> is not opaque, it should only be used with
the following functions, as it is defined differently on different
platforms.</p>
<p>All of the g_static_mutex_* functions apart from
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-get-mutex" title="g_static_mutex_get_mutex ()"><code class="function">g_static_mutex_get_mutex()</code></a> can also be used even if <a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a>
has not yet been called. Then they do nothing, apart from
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-trylock" title="g_static_mutex_trylock ()"><code class="function">g_static_mutex_trylock()</code></a> which does nothing but returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
<p>All of the g_static_mutex_* functions are actually macros. Apart from
taking their addresses, you can however use them as if they were
functions.</p>
</div>
<hr>
<div class="refsect2">
<a name="G-STATIC-MUTEX-INIT:CAPS"></a><h3>G_STATIC_MUTEX_INIT</h3>
<pre class="programlisting">#define G_STATIC_MUTEX_INIT
</pre>
<div class="warning"><p><code class="literal">G_STATIC_MUTEX_INIT</code> is deprecated and should not be used in newly-written code.</p></div>
<p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a> must be initialized with this macro, before it can
be used. This macro can used be to initialize a variable, but it
cannot be assigned to a variable. In that case you have to use
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-mutex-init" title="g_static_mutex_init ()"><code class="function">g_static_mutex_init()</code></a>.</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting">GStaticMutex my_mutex <span class="gtkdoc opt">=</span> G_STATIC_MUTEX_INIT<span class="gtkdoc opt">;</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
</div>
<hr>
<div class="refsect2">
<a name="GStaticRecMutex"></a><h3>struct GStaticRecMutex</h3>
<pre class="programlisting">struct GStaticRecMutex {
};
</pre>
<div class="warning"><p><code class="literal">GStaticRecMutex</code> is deprecated and should not be used in newly-written code.</p></div>
<p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> works like a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>, but it can be locked
multiple times by one thread. If you enter it n times, you have to
unlock it n times again to let other threads lock it. An exception
is the function <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-unlock-full" title="g_static_rec_mutex_unlock_full ()"><code class="function">g_static_rec_mutex_unlock_full()</code></a>: that allows you to
unlock a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> completely returning the depth, (i.e. the
number of times this mutex was locked). The depth can later be used
to restore the state of the <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> by calling
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-lock-full" title="g_static_rec_mutex_lock_full ()"><code class="function">g_static_rec_mutex_lock_full()</code></a>. In GLib 2.32, <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> has
been deprecated in favor of <a class="link" href="glib-Threads.html#GRecMutex" title="struct GRecMutex"><span class="type">GRecMutex</span></a>.</p>
<p>Even though <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> is not opaque, it should only be used
with the following functions.</p>
<p>All of the g_static_rec_mutex_* functions can be used even if
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not been called. Then they do nothing, apart
from <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-trylock" title="g_static_rec_mutex_trylock ()"><code class="function">g_static_rec_mutex_trylock()</code></a>, which does nothing but returning
<a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
</div>
<hr>
<div class="refsect2">
<a name="G-STATIC-REC-MUTEX-INIT:CAPS"></a><h3>G_STATIC_REC_MUTEX_INIT</h3>
<pre class="programlisting">#define G_STATIC_REC_MUTEX_INIT { G_STATIC_MUTEX_INIT }
</pre>
<div class="warning"><p><code class="literal">G_STATIC_REC_MUTEX_INIT</code> is deprecated and should not be used in newly-written code.</p></div>
<p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRecMutex" title="struct GStaticRecMutex"><span class="type">GStaticRecMutex</span></a> must be initialized with this macro before it can
be used. This macro can used be to initialize a variable, but it
cannot be assigned to a variable. In that case you have to use
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rec-mutex-init" title="g_static_rec_mutex_init ()"><code class="function">g_static_rec_mutex_init()</code></a>.</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting">GStaticRecMutex my_mutex <span class="gtkdoc opt">=</span> G_STATIC_REC_MUTEX_INIT<span class="gtkdoc opt">;</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
</div>
<hr>
<div class="refsect2">
<a name="GStaticRWLock"></a><h3>struct GStaticRWLock</h3>
<pre class="programlisting">struct GStaticRWLock {
};
</pre>
<div class="warning">
<p><code class="literal">GStaticRWLock</code> has been deprecated since version 2.32 and should not be used in newly-written code.</p>
<p>Use a <a class="link" href="glib-Threads.html#GRWLock" title="struct GRWLock"><span class="type">GRWLock</span></a> instead</p>
</div>
<p>The <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> struct represents a read-write lock. A read-write
lock can be used for protecting data that some portions of code only
read from, while others also write. In such situations it is
desirable that several readers can read at once, whereas of course
only one writer may write at a time.</p>
<p>Take a look at the following example:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33</pre></td>
        <td class="listing_code"><pre class="programlisting">GStaticRWLock rwlock <span class="gtkdoc opt">=</span> G_STATIC_RW_LOCK_INIT<span class="gtkdoc opt">;</span>
GPtrArray <span class="gtkdoc opt">*</span>array<span class="gtkdoc opt">;</span>

gpointer
<span class="function">my_array_get</span> <span class="gtkdoc opt">(</span>guint index<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  gpointer retval <span class="gtkdoc opt">=</span> NULL<span class="gtkdoc opt">;</span>

  <span class="keyword">if</span> <span class="gtkdoc opt">(!</span>array<span class="gtkdoc opt">)</span>
    <span class="keyword">return</span> NULL<span class="gtkdoc opt">;</span>

  <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-lock">g_static_rw_lock_reader_lock</a></span> <span class="gtkdoc opt">(&amp;</span>rwlock<span class="gtkdoc opt">);</span>
  <span class="keyword">if</span> <span class="gtkdoc opt">(</span>index <span class="gtkdoc opt">&lt;</span> array<span class="gtkdoc opt">-&gt;</span>len<span class="gtkdoc opt">)</span>
    retval <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-index">g_ptr_array_index</a></span> <span class="gtkdoc opt">(</span>array<span class="gtkdoc opt">,</span> index<span class="gtkdoc opt">);</span>
  <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock">g_static_rw_lock_reader_unlock</a></span> <span class="gtkdoc opt">(&amp;</span>rwlock<span class="gtkdoc opt">);</span>

  <span class="keyword">return</span> retval<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span>

<span class="gtkdoc kwb">void</span>
<span class="function">my_array_set</span> <span class="gtkdoc opt">(</span>guint index<span class="gtkdoc opt">,</span> gpointer data<span class="gtkdoc opt">)</span>
<span class="gtkdoc opt">{</span>
  <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-lock">g_static_rw_lock_writer_lock</a></span> <span class="gtkdoc opt">(&amp;</span>rwlock<span class="gtkdoc opt">);</span>

  <span class="keyword">if</span> <span class="gtkdoc opt">(!</span>array<span class="gtkdoc opt">)</span>
    array <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-new">g_ptr_array_new</a></span> <span class="gtkdoc opt">();</span>

  <span class="keyword">if</span> <span class="gtkdoc opt">(</span>index <span class="gtkdoc opt">&gt;=</span> array<span class="gtkdoc opt">-&gt;</span>len<span class="gtkdoc opt">)</span>
    <span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-set-size">g_ptr_array_set_size</a></span> <span class="gtkdoc opt">(</span>array<span class="gtkdoc opt">,</span> index <span class="gtkdoc opt">+</span> <span class="number">1</span><span class="gtkdoc opt">);</span>
  <span class="function"><a href="glib-Pointer-Arrays.html#g-ptr-array-index">g_ptr_array_index</a></span> <span class="gtkdoc opt">(</span>array<span class="gtkdoc opt">,</span> index<span class="gtkdoc opt">) =</span> data<span class="gtkdoc opt">;</span>

  <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-writer-unlock">g_static_rw_lock_writer_unlock</a></span> <span class="gtkdoc opt">(&amp;</span>rwlock<span class="gtkdoc opt">);</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
<p>This example shows an array which can be accessed by many readers
(the <code class="function">my_array_get()</code> function) simultaneously, whereas the writers
(the <code class="function">my_array_set()</code> function) will only be allowed once at a time
and only if no readers currently access the array. This is because
of the potentially dangerous resizing of the array. Using these
functions is fully multi-thread safe now.</p>
<p>Most of the time, writers should have precedence over readers. That
means, for this implementation, that as soon as a writer wants to
lock the data, no other reader is allowed to lock the data, whereas,
of course, the readers that already have locked the data are allowed
to finish their operation. As soon as the last reader unlocks the
data, the writer will lock it.</p>
<p>Even though <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> is not opaque, it should only be used
with the following functions.</p>
<p>All of the g_static_rw_lock_* functions can be used even if
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-thread-init" title="g_thread_init ()"><code class="function">g_thread_init()</code></a> has not been called. Then they do nothing, apart
from g_static_rw_lock_*_trylock, which does nothing but returning <a class="link" href="glib-Standard-Macros.html#TRUE:CAPS" title="TRUE"><code class="literal">TRUE</code></a>.</p>
<p>A read-write lock has a higher overhead than a mutex. For example, both
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-lock" title="g_static_rw_lock_reader_lock ()"><code class="function">g_static_rw_lock_reader_lock()</code></a> and <a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-reader-unlock" title="g_static_rw_lock_reader_unlock ()"><code class="function">g_static_rw_lock_reader_unlock()</code></a> have
to lock and unlock a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>, so it takes at least twice the time
to lock and unlock a <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> that it does to lock and unlock a
<a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>. So only data structures that are accessed by multiple
readers, and which keep the lock for a considerable time justify a
<a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a>. The above example most probably would fare better with a
<a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
</div>
<hr>
<div class="refsect2">
<a name="G-STATIC-RW-LOCK-INIT:CAPS"></a><h3>G_STATIC_RW_LOCK_INIT</h3>
<pre class="programlisting">#define G_STATIC_RW_LOCK_INIT { G_STATIC_MUTEX_INIT, NULL, NULL, 0, FALSE, 0, 0 }
</pre>
<div class="warning"><p><code class="literal">G_STATIC_RW_LOCK_INIT</code> is deprecated and should not be used in newly-written code.</p></div>
<p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticRWLock" title="struct GStaticRWLock"><span class="type">GStaticRWLock</span></a> must be initialized with this macro before it can
be used. This macro can used be to initialize a variable, but it
cannot be assigned to a variable. In that case you have to use
<a class="link" href="glib-Deprecated-Thread-APIs.html#g-static-rw-lock-init" title="g_static_rw_lock_init ()"><code class="function">g_static_rw_lock_init()</code></a>.</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting">GStaticRWLock my_lock <span class="gtkdoc opt">=</span> G_STATIC_RW_LOCK_INIT<span class="gtkdoc opt">;</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
</div>
<hr>
<div class="refsect2">
<a name="GStaticPrivate"></a><h3>struct GStaticPrivate</h3>
<pre class="programlisting">struct GStaticPrivate {
};
</pre>
<div class="warning"><p><code class="literal">GStaticPrivate</code> is deprecated and should not be used in newly-written code.</p></div>
<p>A <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> works almost like a <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a>, but it has one
significant advantage. It doesn't need to be created at run-time
like a <a class="link" href="glib-Threads.html#GPrivate" title="struct GPrivate"><span class="type">GPrivate</span></a>, but can be defined at compile-time. This is
similar to the difference between <a class="link" href="glib-Threads.html#GMutex" title="union GMutex"><span class="type">GMutex</span></a> and <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticMutex" title="GStaticMutex"><span class="type">GStaticMutex</span></a>.</p>
<p>Now look at our <code class="function">give_me_next_number()</code> example with <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a>:</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17</pre></td>
        <td class="listing_code"><pre class="programlisting"><span class="gtkdoc kwb">int</span>
<span class="function">give_me_next_number</span> <span class="gtkdoc opt">()</span>
<span class="gtkdoc opt">{</span>
  <span class="gtkdoc kwb">static</span> GStaticPrivate current_number_key <span class="gtkdoc opt">=</span> G_STATIC_PRIVATE_INIT<span class="gtkdoc opt">;</span>
  <span class="gtkdoc kwb">int</span> <span class="gtkdoc opt">*</span>current_number <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-private-get">g_static_private_get</a></span> <span class="gtkdoc opt">(&amp;</span>current_number_key<span class="gtkdoc opt">);</span>

  <span class="keyword">if</span> <span class="gtkdoc opt">(!</span>current_number<span class="gtkdoc opt">)</span>
    <span class="gtkdoc opt">{</span>
      current_number <span class="gtkdoc opt">=</span> <span class="function"><a href="glib-Memory-Allocation.html#g-new">g_new</a></span> <span class="gtkdoc opt">(</span><span class="gtkdoc kwb">int</span><span class="gtkdoc opt">,</span> <span class="number">1</span><span class="gtkdoc opt">);</span>
      <span class="gtkdoc opt">*</span>current_number <span class="gtkdoc opt">=</span> <span class="number">0</span><span class="gtkdoc opt">;</span>
      <span class="function"><a href="glib-Deprecated-Thread-APIs.html#g-static-private-set">g_static_private_set</a></span> <span class="gtkdoc opt">(&amp;</span>current_number_key<span class="gtkdoc opt">,</span> current_number<span class="gtkdoc opt">,</span> g_free<span class="gtkdoc opt">);</span>
    <span class="gtkdoc opt">}</span>

  <span class="gtkdoc opt">*</span>current_number <span class="gtkdoc opt">=</span> <span class="function">calc_next_number</span> <span class="gtkdoc opt">(*</span>current_number<span class="gtkdoc opt">);</span>

  <span class="keyword">return</span> <span class="gtkdoc opt">*</span>current_number<span class="gtkdoc opt">;</span>
<span class="gtkdoc opt">}</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
</div>
<hr>
<div class="refsect2">
<a name="G-STATIC-PRIVATE-INIT:CAPS"></a><h3>G_STATIC_PRIVATE_INIT</h3>
<pre class="programlisting">#define G_STATIC_PRIVATE_INIT 
</pre>
<div class="warning"><p><code class="literal">G_STATIC_PRIVATE_INIT</code> is deprecated and should not be used in newly-written code.</p></div>
<p>Every <a class="link" href="glib-Deprecated-Thread-APIs.html#GStaticPrivate" title="struct GStaticPrivate"><span class="type">GStaticPrivate</span></a> must be initialized with this macro, before it
can be used.</p>
<div class="informalexample">
  <table class="listing_frame" border="0" cellpadding="0" cellspacing="0">
    <tbody>
      <tr>
        <td class="listing_lines" align="right"><pre>1</pre></td>
        <td class="listing_code"><pre class="programlisting">GStaticPrivate my_private <span class="gtkdoc opt">=</span> G_STATIC_PRIVATE_INIT<span class="gtkdoc opt">;</span></pre></td>
      </tr>
    </tbody>
  </table>
</div>

<p></p>
</div>
</div>
<div class="refsect1">
<a name="glib-Deprecated-Thread-APIs.see-also"></a><h2>See Also</h2>
<p><a class="link" href="glib-Threads.html#GThread" title="GThread"><span class="type">GThread</span></a></p>
</div>
</div>
<div class="footer">
<hr>Generated by GTK-Doc V1.25.1</div>
</body>
</html>